package com.example.dakotanews.dto;

import com.example.dakotanews.entity.Blog;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description 用户属性信息中的博客信息
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserBlogDTO {

    private Integer id;
    private String title;
    private String content;
    private String createdTime;
    private int voteCount;

    // createdTime即editTime，若为空则赋publishTime值 需要单独赋值，在服务层统一处理
    public UserBlogDTO(Blog blog) {
        this.id = blog.getId();
        this.title = blog.getTitle();
        this.content = blog.getSummary();
        this.voteCount = blog.getSupportNum();
    }
}
